const Router = require('koa-router')
//

const {
  create,
  get,
  list,
  del,
  listByUasIdAndDate,
} = require('../../../controller/v1/admin/uav_patrol')

const { uasIdParseInt } = require('../../../middleware/convert/parseUasId')
const {
  createValidator,
  delValidator,
  listValidator,
  getValidator,
  listByUasIdAndDateValidator,
} = require('../../../middleware/validator/v1/uav_patrol')

const { validateToken } = require('../../../middleware/auth/token')

const { reqLog } = require('../../../middleware/log/log')

const PREFIX = '/v1/admin/patrol'

const router = new Router({ prefix: PREFIX })

router.get('/get', validateToken, getValidator, get)

router.post('/create', validateToken, createValidator, reqLog, create)

router.del('/del', validateToken, delValidator, reqLog, del)

router.get('/list', validateToken, listValidator, list)

// 列表
router.get(
  '/listByUasIdAndDate',
  validateToken,
  uasIdParseInt,
  listByUasIdAndDateValidator,
  listByUasIdAndDate
)

module.exports = router
